package com.example.take_out_admin.webConfig;

import com.example.take_out_admin.common.Result;
import com.example.take_out_admin.exception.ResponseEnum;
import com.example.take_out_admin.exception.business.AuthenticationException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
//
//    @ExceptionHandler(Exception.class)
//    public Result<Object> handleCustomException(Exception e) {
//            return Result.error(ResponseEnum.UNKOWN_ERROR);
//    }

    @ExceptionHandler(AuthenticationException.class)
    public Result<Object> handleGeneralException(Exception e) {
          return Result.error(ResponseEnum.INTERNAL_SERVER_ERROR_USERNOTFOUND);
    }

    // 可以添加更多的异常处理方法
}